<template>
  <div class="jbc-menu">
    <div class="jbc-menu__body">
      <routerLink to="/type" class="jbc-menu__item first-type">商品分类 <el-icon>
          <ArrowDownBold />
        </el-icon></RouterLink>
      <routerLink to="/" class="jbc-menu__item" :class="{ active: path.index }">首页</RouterLink>
      <routerLink to="/pre_sale" class="jbc-menu__item" :class="{ active: path.presale }">商品预售</RouterLink>
      <routerLink to="/distribution" class="jbc-menu__item" :class="{ active: path.distribution }">分货活动</RouterLink>
    </div>
  </div>
</template>

<script setup name="JbcMenu">
const route = useRoute()
const path = computed(() => {
  return {
    index: route.path.includes('/index'),
    presale: route.path.includes('/pre_sale'),
    distribution: route.path.includes('/distribution')
  }
})
</script>

<style lang="scss" scoped>
.jbc-menu {
  width: 100%;
  height: 50px;
  border-bottom: 3px solid var(--jbc-color);
  background-color: #fff;

  &__body {
    width: var(--box-width);
    margin: 0 auto;
    display: flex;
    align-items: stretch;
  }

  &__item {
    display: inline-block;
    line-height: 50px;
    font-family: MicrosoftYaHei, MicrosoftYaHei, PingFangSC-Regular;
    font-weight: bold;
    font-size: 18px;
    color: var(--jbc-font-color);
    padding: 0 29px;

    &.active {
      color: var(--jbc-color);
    }
  }

  .first-type {
    background-color: var(--jbc-color);
    width: 270px;
    color: #fff;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-right: 29px;
  }
}
</style>